GError **error)
{
gboolean ret = FALSE;
- SoupMessage *msg = NULL;
guint response;
- char *uri_string = NULL;
- GFile *ret_temp_filename = NULL;
- GOutputStream *output_stream = NULL;
+ ot_lfree char *uri_string = NULL;
+ ot_lobj GFile *ret_temp_filename = NULL;
+ ot_lobj GOutputStream *output_stream = NULL;
+ ot_lobj SoupMessage *msg = NULL;
OstreeSoupChunkData chunkdata;
if (!ostree_create_temp_regular_file (ostree_repo_get_tmpdir (pull_data->repo),
out:
if (ret_temp_filename)
(void) unlink (ot_gfile_get_path_cached (ret_temp_filename));
- g_clear_object (&ret_temp_filename);
- g_free (uri_string);
- g_clear_object (&msg);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *tmpf = NULL;
- char *ret_contents = NULL;
+ ot_lobj GFile *tmpf = NULL;
+ ot_lfree char *ret_contents = NULL;
gsize len;
if (!fetch_uri (pull_data, uri, "tmp-", &tmpf, cancellable, error))
out:
if (tmpf)
(void) unlink (ot_gfile_get_path_cached (tmpf));
- g_clear_object (&tmpf);
- g_free (ret_contents);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *ret_cached_path = NULL;
- GFile *tmp_path = NULL;
- char *pack_name = NULL;
+ ot_lobj GFile *ret_cached_path = NULL;
+ ot_lobj GFile *tmp_path = NULL;
+ ot_lfree char *pack_name = NULL;
SoupURI *pack_uri = NULL;
if (!ostree_repo_get_cached_remote_pack_data (pull_data->repo, pull_data->remote_name,
ret = TRUE;
ot_transfer_out_value (out_cached_path, &ret_cached_path);
out:
- g_clear_object (&ret_cached_path);
- g_clear_object (&tmp_path);
- g_free (pack_name);
if (pack_uri)
soup_uri_free (pack_uri);
return ret;
GError **error)
{
gboolean ret = FALSE;
- GVariant *mapped_pack = NULL;
- GVariant *csum_bytes = NULL;
- char *ret_pack_checksum = NULL;
guint64 offset;
guint i;
+ ot_lvariant GVariant *mapped_pack = NULL;
+ ot_lvariant GVariant *csum_bytes = NULL;
+ ot_lfree char *ret_pack_checksum = NULL;
csum_bytes = ostree_checksum_to_bytes (checksum);
if (out_offset)
*out_offset = offset;
out:
- ot_clear_gvariant (&mapped_pack);
- g_free (ret_pack_checksum);
- ot_clear_gvariant (&csum_bytes);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
+ ot_lobj GFile *tmp_path = NULL;
+ ot_lfree char *pack_index_name = NULL;
SoupURI *index_uri = NULL;
- GFile *tmp_path = NULL;
- char *pack_index_name = NULL;
pack_index_name = g_strconcat ("ostpack-", pack_checksum, ".index", NULL);
index_uri = suburi_new (pull_data->base_uri, "objects", "pack", pack_index_name, NULL);
out:
if (tmp_path != NULL)
(void) ot_gfile_unlink (tmp_path, NULL, NULL);
- g_clear_object (&tmp_path);
- g_free (pack_index_name);
if (index_uri)
soup_uri_free (index_uri);
return ret;
GError **error)
{
gboolean ret = FALSE;
- SoupURI *superindex_uri = NULL;
- GFile *superindex_tmppath = NULL;
- GPtrArray *cached_indexes = NULL;
- GPtrArray *uncached_indexes = NULL;
- GVariant *superindex_variant = NULL;
- GVariantIter *contents_iter = NULL;
guint i;
+ ot_lobj GFile *superindex_tmppath = NULL;
+ ot_lptrarray GPtrArray *cached_indexes = NULL;
+ ot_lptrarray GPtrArray *uncached_indexes = NULL;
+ ot_lvariant GVariant *superindex_variant = NULL;
+ GVariantIter *contents_iter = NULL;
+ SoupURI *superindex_uri = NULL;
superindex_uri = suburi_new (pull_data->base_uri, "objects", "pack", "index", NULL);
out:
if (superindex_uri)
soup_uri_free (superindex_uri);
- g_clear_object (&superindex_tmppath);
- ot_clear_gvariant (&superindex_variant);
if (contents_iter)
g_variant_iter_free (contents_iter);
return ret;
GError **error)
{
gboolean ret = FALSE;
- char *objpath = NULL;
+ ot_lfree char *objpath = NULL;
+ ot_lobj GFile *ret_temp_path = NULL;
SoupURI *obj_uri = NULL;
- GFile *ret_temp_path = NULL;
objpath = ostree_get_relative_object_path (checksum, objtype);
obj_uri = suburi_new (pull_data->base_uri, objpath, NULL);
out:
if (obj_uri)
soup_uri_free (obj_uri);
- g_clear_object (&ret_temp_path);
- g_free (objpath);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GInputStream *ret_input = NULL;
- GFile *temp_path = NULL;
- GFile *stored_path = NULL;
- GFile *pack_path = NULL;
- GMappedFile *pack_map = NULL;
- char *local_pack_checksum = NULL;
- char *remote_pack_checksum = NULL;
guint64 pack_offset = 0;
- GVariant *pack_entry = NULL;
gboolean is_stored;
+ ot_lobj GInputStream *ret_input = NULL;
+ ot_lobj GFile *temp_path = NULL;
+ ot_lobj GFile *stored_path = NULL;
+ ot_lobj GFile *pack_path = NULL;
+ ot_lfree char *local_pack_checksum = NULL;
+ ot_lfree char *remote_pack_checksum = NULL;
+ ot_lvariant GVariant *pack_entry = NULL;
+ GMappedFile *pack_map = NULL;
if (!ostree_repo_find_object (pull_data->repo, objtype, checksum,
&stored_path, &local_pack_checksum, NULL,
ret = TRUE;
ot_transfer_out_value (out_input, &ret_input);
out:
- g_free (local_pack_checksum);
- g_clear_object (&stored_path);
- g_clear_object (&temp_path);
- g_clear_object (&pack_path);
if (pack_map)
g_mapped_file_unref (pack_map);
- ot_clear_gvariant (&pack_entry);
- g_clear_object (&pack_path);
- g_clear_object (&ret_input);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFileInfo *file_info = NULL;
- GInputStream *input = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
+ ot_lobj GInputStream *input = NULL;
g_assert (objtype != OSTREE_OBJECT_TYPE_RAW_FILE);
ret = TRUE;
out:
- g_clear_object (&file_info);
- g_clear_object (&input);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GVariant *ret_variant = NULL;
+ ot_lvariant GVariant *ret_variant = NULL;
if (!fetch_and_store_object (pull_data, checksum, objtype,
cancellable, error))
ret = TRUE;
ot_transfer_out_value (out_variant, &ret_variant);
out:
- ot_clear_gvariant (&ret_variant);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GInputStream *input = NULL;
- GFile *stored_path = NULL;
- char *pack_checksum = NULL;
- GVariant *archive_metadata_container = NULL;
- GVariant *archive_metadata = NULL;
- GFileInfo *archive_file_info = NULL;
- GVariant *archive_xattrs = NULL;
gboolean skip_archive_fetch;
+ ot_lobj GInputStream *input = NULL;
+ ot_lobj GFile *stored_path = NULL;
+ ot_lfree char *pack_checksum = NULL;
+ ot_lvariant GVariant *archive_metadata_container = NULL;
+ ot_lvariant GVariant *archive_metadata = NULL;
+ ot_lobj GFileInfo *archive_file_info = NULL;
+ ot_lvariant GVariant *archive_xattrs = NULL;
/* If we're fetching from an archive into a bare repository, we need
* to explicitly check for raw file types locally.
ret = TRUE;
out:
- g_free (pack_checksum);
- g_clear_object (&stored_path);
- g_clear_object (&input);
- ot_clear_gvariant (&archive_metadata_container);
- ot_clear_gvariant (&archive_metadata);
- ot_clear_gvariant (&archive_xattrs);
- g_clear_object (&archive_file_info);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GVariant *tree = NULL;
- GVariant *files_variant = NULL;
- GVariant *dirs_variant = NULL;
int i, n;
- GFile *stored_path = NULL;
- char *pack_checksum = NULL;
+ ot_lvariant GVariant *tree = NULL;
+ ot_lvariant GVariant *files_variant = NULL;
+ ot_lvariant GVariant *dirs_variant = NULL;
+ ot_lobj GFile *stored_path = NULL;
+ ot_lfree char *pack_checksum = NULL;
if (!fetch_and_store_metadata (pull_data, rev, OSTREE_OBJECT_TYPE_DIR_TREE,
&tree, cancellable, error))
ret = TRUE;
out:
- ot_clear_gvariant (&tree);
- ot_clear_gvariant (&files_variant);
- ot_clear_gvariant (&dirs_variant);
- g_clear_object (&stored_path);
- g_free (pack_checksum);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GVariant *commit = NULL;
+ ot_lvariant GVariant *commit = NULL;
const char *tree_contents_checksum;
const char *tree_meta_checksum;
ret = TRUE;
out:
- ot_clear_gvariant (&commit);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- char *ret_contents = NULL;
+ ot_lfree char *ret_contents = NULL;
SoupURI *target_uri = NULL;
target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL);
ret = TRUE;
ot_transfer_out_value (out_contents, &ret_contents);
out:
- g_free (ret_contents);
if (target_uri)
soup_uri_free (target_uri);
return ret;
GError **error)
{
gboolean ret = FALSE;
- char *key = NULL;
- char *remote_ref = NULL;
- char *baseurl = NULL;
- char *original_rev = NULL;
+ ot_lfree char *key = NULL;
+ ot_lfree char *remote_ref = NULL;
+ ot_lfree char *baseurl = NULL;
+ ot_lfree char *original_rev = NULL;
remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, branch);
ret = TRUE;
out:
- g_free (key);
- g_free (remote_ref);
- g_free (baseurl);
- g_free (original_rev);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GHashTable *ret_refs = NULL;
+ ot_lhash GHashTable *ret_refs = NULL;
char **lines = NULL;
char **iter = NULL;
char *ref = NULL;
ret = TRUE;
ot_transfer_out_value (out_refs, &ret_refs);
out:
- if (ret_refs)
- g_hash_table_unref (ret_refs);
g_strfreev (lines);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
+ GHashTableIter hash_iter;
+ gpointer key, value;
+ int i;
+ GCancellable *cancellable = NULL;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lfree char *path = NULL;
+ ot_lfree char *baseurl = NULL;
+ ot_lfree char *summary_data = NULL;
+ ot_lhash GHashTable *refs_to_fetch = NULL;
+ ot_lhash GHashTable *commits_to_fetch = NULL;
+ ot_lfree char *branch_rev = NULL;
OtPullData pull_data_real;
OtPullData *pull_data = &pull_data_real;
- OstreeRepo *repo = NULL;
- char *path = NULL;
- char *baseurl = NULL;
- char *summary_data = NULL;
SoupURI *summary_uri = NULL;
GKeyFile *config = NULL;
- GCancellable *cancellable = NULL;
- GHashTable *refs_to_fetch = NULL;
- GHashTable *commits_to_fetch = NULL;
- GHashTableIter hash_iter;
- gpointer key, value;
- char *branch_rev = NULL;
char **configured_branches = NULL;
- int i;
context = g_option_context_new ("REMOTE [BRANCH...] - Download data from remote repository");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- if (refs_to_fetch)
- g_hash_table_unref (refs_to_fetch);
- ot_clear_hashtable (&commits_to_fetch);
g_strfreev (configured_branches);
- g_free (path);
- g_free (baseurl);
- g_free (summary_data);
- g_free (branch_rev);
- ot_clear_hashtable (&(pull_data->file_checksums_to_fetch));
if (context)
g_option_context_free (context);
g_clear_object (&pull_data->session);
g_ptr_array_unref (pull_data->cached_pack_indexes);
if (summary_uri)
soup_uri_free (summary_uri);
- g_clear_object (&repo);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GInputStream *in = NULL;
+ ot_lobj GInputStream *in = NULL;
in = (GInputStream*)g_file_read (f, cancellable, error);
if (!in)
ret = TRUE;
out:
- g_clear_object (&in);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
int i;
GCancellable *cancellable = NULL;
const char *rev;
- GOutputStream *stdout_stream = NULL;
- GFile *root = NULL;
- GFile *f = NULL;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lobj GOutputStream *stdout_stream = NULL;
+ ot_lobj GFile *root = NULL;
+ ot_lobj GFile *f = NULL;
context = g_option_context_new ("COMMIT PATH [PATH...] - Concatenate contents of files");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- g_clear_object (&root);
- g_clear_object (&f);
- g_clear_object (&stdout_stream);
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *parent = NULL;
- char *tmp_name = NULL;
- GFile *tmp_link = NULL;
+ ot_lobj GFile *parent = NULL;
+ ot_lfree char *tmp_name = NULL;
+ ot_lobj GFile *tmp_link = NULL;
parent = g_file_get_parent (dest);
/* HACK - should use randomly generated temporary target name */
ret = TRUE;
out:
- g_free (tmp_name);
- g_clear_object (&parent);
- g_clear_object (&tmp_link);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFileInfo *file_info = NULL;
const char *target;
const char *last_dash;
const char *checksum;
- char *ret_commit = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
+ ot_lfree char *ret_commit = NULL;
file_info = g_file_query_info (symlink, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
ret = TRUE;
ot_transfer_out_value (out_commit, &ret_commit);
out:
- g_free (ret_commit);
- g_clear_object (&file_info);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- OstreeRepoFile *root = NULL;
- OstreeRepoFile *subtree = NULL;
- GFileInfo *file_info = NULL;
+ ot_lobj OstreeRepoFile *root = NULL;
+ ot_lobj OstreeRepoFile *subtree = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
root = (OstreeRepoFile*)ostree_repo_file_new_root (repo, resolved_commit);
if (!ostree_repo_file_ensure_resolved (root, error))
ret = TRUE;
out:
- g_clear_object (&subtree);
- g_clear_object (&root);
- g_clear_object (&file_info);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GInputStream *stdin_stream = NULL;
- GDataInputStream *stdin_data = NULL;
- char *revision = NULL;
- char *subpath = NULL;
- char *resolved_commit = NULL;
gsize len;
GError *temp_error = NULL;
+ ot_lobj GInputStream *stdin_stream = NULL;
+ ot_lobj GDataInputStream *stdin_data = NULL;
+ ot_lfree char *revision = NULL;
+ ot_lfree char *subpath = NULL;
+ ot_lfree char *resolved_commit = NULL;
stdin_stream = (GInputStream*)g_unix_input_stream_new (0, FALSE);
stdin_data = g_data_input_stream_new (stdin_stream);
ret = TRUE;
out:
- g_free (subpath);
- g_free (revision);
- g_free (resolved_commit);
- g_clear_object (&stdin_stream);
- g_clear_object (&stdin_data);
return ret;
}
GOptionContext *context;
GCancellable *cancellable = NULL;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
const char *commit;
- char *existing_commit = NULL;
- char *resolved_commit = NULL;
const char *destination;
- char *suffixed_destination = NULL;
- char *tmp_destination = NULL;
- GFileInfo *symlink_file_info = NULL;
- GFile *checkout_target = NULL;
- GFile *checkout_target_tmp = NULL;
- GFile *symlink_target = NULL;
gboolean skip_checkout;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lfree char *existing_commit = NULL;
+ ot_lfree char *resolved_commit = NULL;
+ ot_lfree char *suffixed_destination = NULL;
+ ot_lfree char *tmp_destination = NULL;
+ ot_lobj GFileInfo *symlink_file_info = NULL;
+ ot_lobj GFile *checkout_target = NULL;
+ ot_lobj GFile *checkout_target_tmp = NULL;
+ ot_lobj GFile *symlink_target = NULL;
context = g_option_context_new ("COMMIT DESTINATION - Check out a commit into a filesystem tree");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- g_free (suffixed_destination);
- g_free (tmp_destination);
- g_free (resolved_commit);
- g_free (existing_commit);
- g_clear_object (&symlink_target);
- g_clear_object (&checkout_target_tmp);
- g_clear_object (&checkout_target);
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
- g_clear_object (&symlink_file_info);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- GFile *f = NULL;
+ ot_lobj GFile *f = NULL;
AsyncChecksumData data;
context = g_option_context_new ("FILENAME - Checksum a file or directory");
out:
if (data.loop)
g_main_loop_unref (data.loop);
- g_clear_object (&f);
if (context)
g_option_context_free (context);
return ret;
GError **error)
{
gboolean ret = FALSE;
- GFile *path = NULL;
- char *contents = NULL;
gsize len;
- GHashTable *ret_hash = NULL;
+ char **iter = NULL; /* nofree */
+ ot_lhash GHashTable *ret_hash = NULL;
+ ot_lobj GFile *path = NULL;
+ ot_lfree char *contents = NULL;
char **lines = NULL;
- char **iter = NULL;
path = ot_gfile_new_for_path (statoverride_file);
ret = TRUE;
ot_transfer_out_value (out_mode_add, &ret_hash);
out:
- if (ret_hash)
- g_hash_table_unref (ret_hash);
- g_free (contents);
g_strfreev (lines);
- g_clear_object (&path);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
- GFile *arg = NULL;
- char *parent = NULL;
- char *commit_checksum = NULL;
- GVariant *parent_commit = NULL;
- GVariant *metadata = NULL;
- GMappedFile *metadata_mappedf = NULL;
- GFile *metadata_f = NULL;
- OstreeRepoCommitModifier *modifier = NULL;
- char *contents_checksum = NULL;
+ gboolean skip_commit = FALSE;
+ gboolean in_transaction = FALSE;
GCancellable *cancellable = NULL;
- OstreeMutableTree *mtree = NULL;
- char *tree_type = NULL;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lobj GFile *arg = NULL;
+ ot_lfree char *parent = NULL;
+ ot_lfree char *commit_checksum = NULL;
+ ot_lvariant GVariant *parent_commit = NULL;
+ ot_lvariant GVariant *metadata = NULL;
+ ot_lobj GFile *metadata_f = NULL;
+ ot_lfree char *contents_checksum = NULL;
+ ot_lobj OstreeMutableTree *mtree = NULL;
+ ot_lfree char *tree_type = NULL;
+ ot_lhash GHashTable *mode_adds = NULL;
+ OstreeRepoCommitModifier *modifier = NULL;
+ GMappedFile *metadata_mappedf = NULL;
GVariantBuilder metadata_builder;
gboolean metadata_builder_initialized = FALSE;
- gboolean skip_commit = FALSE;
- gboolean in_transaction = FALSE;
- GHashTable *mode_adds = NULL;
context = g_option_context_new ("[ARG] - Commit a new revision");
g_option_context_add_main_entries (context, options, NULL);
NULL, error);
if (!metadata)
goto out;
+ g_variant_ref_sink (metadata);
}
else if (metadata_bin_path)
{
}
metadata = g_variant_builder_end (&metadata_builder);
metadata_builder_initialized = FALSE;
+ g_variant_ref_sink (metadata);
}
if (statoverride_file)
}
if (metadata_builder_initialized)
g_variant_builder_clear (&metadata_builder);
- g_clear_object (&arg);
- g_clear_object (&mtree);
- g_free (contents_checksum);
- g_free (parent);
- ot_clear_gvariant(&parent_commit);
- if (mode_adds)
- g_hash_table_unref (mode_adds);
- g_free (tree_type);
if (metadata_mappedf)
g_mapped_file_unref (metadata_mappedf);
if (context)
g_option_context_free (context);
if (modifier)
ostree_repo_commit_modifier_unref (modifier);
- g_clear_object (&repo);
- g_free (commit_checksum);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *branchf = NULL;
- GFile *subdir = NULL;
const char *branch_rev;
- char **components = NULL;
const char *branch_name;
const char *path;
+ ot_lobj GFile *branchf = NULL;
+ ot_lobj GFile *subdir = NULL;
+ char **components = NULL;
components = g_strsplit (branch_path, ":", 2);
ret = TRUE;
out:
g_strfreev (components);
- g_clear_object (&branchf);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
- char *parent = NULL;
- GFile *destf = NULL;
- GHashTable *seen_branches = NULL;
+ GCancellable *cancellable = NULL;
+ int i;
+ gboolean skip_commit = FALSE;
+ gboolean in_transaction = FALSE;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lfree char *parent = NULL;
+ ot_lobj GFile *destf = NULL;
+ ot_lhash GHashTable *seen_branches = NULL;
+ ot_lvariant GVariant *parent_commit = NULL;
+ ot_lvariant GVariant *parent_commit_metadata = NULL;
+ ot_lvariant GVariant *parent_commit_compose = NULL;
+ ot_lvariant GVariant *commit_metadata = NULL;
+ ot_lfree char *contents_checksum = NULL;
+ ot_lfree char *commit_checksum = NULL;
+ ot_lobj GFile *metadata_f = NULL;
+ ot_lobj GFile *from_file = NULL;
+ ot_lfree char *from_file_contents = NULL;
gboolean compose_metadata_builder_initialized = FALSE;
GVariantBuilder compose_metadata_builder;
gboolean commit_metadata_builder_initialized = FALSE;
GVariantBuilder commit_metadata_builder;
- GVariant *parent_commit = NULL;
- GVariant *parent_commit_metadata = NULL;
- GVariant *parent_commit_compose = NULL;
- GVariant *commit_metadata = NULL;
GVariantIter *parent_commit_compose_iter = NULL;
- char *contents_checksum = NULL;
- char *commit_checksum = NULL;
- GCancellable *cancellable = NULL;
- GFile *metadata_f = NULL;
- GFile *from_file = NULL;
- char *from_file_contents = NULL;
char **from_file_args = NULL;
OstreeMutableTree *mtree = NULL;
- gboolean skip_commit = FALSE;
- gboolean in_transaction = FALSE;
- int i;
context = g_option_context_new ("BRANCH1 BRANCH2 ... - Merge multiple commits into a single commit tree");
g_option_context_add_main_entries (context, options, NULL);
{
(void) ostree_repo_abort_transaction (repo, cancellable, NULL);
}
-
if (compose_metadata_builder_initialized)
g_variant_builder_clear (&compose_metadata_builder);
if (commit_metadata_builder_initialized)
g_variant_builder_clear (&commit_metadata_builder);
if (context)
g_option_context_free (context);
- g_free (parent);
- g_free (contents_checksum);
- g_free (commit_checksum);
- if (seen_branches)
- g_hash_table_destroy (seen_branches);
- ot_clear_gvariant (&commit_metadata);
- ot_clear_gvariant (&parent_commit);
- ot_clear_gvariant (&parent_commit_metadata);
- ot_clear_gvariant (&parent_commit_compose);
if (parent_commit_compose_iter)
g_variant_iter_free (parent_commit_compose_iter);
- g_clear_object (&repo);
- g_clear_object (&destf);
- g_clear_object (&metadata_f);
- g_clear_object (&mtree);
- g_clear_object (&from_file);
- g_free (from_file_contents);
g_strfreev (from_file_args);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *ret_file = NULL;
+ ot_lfree GFile *ret_file = NULL;
if (g_str_has_prefix (arg, "/")
|| g_str_has_prefix (arg, "./")
}
ret = TRUE;
- *out_file = ret_file;
- ret_file = NULL;
+ ot_transfer_out_value (out_file, &ret_file);
out:
- g_clear_object (&ret_file);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
+ ot_lfree char *ret_checksum = NULL;
GChecksum *tmp_checksum = NULL;
- char *ret_checksum = NULL;
if (OSTREE_IS_REPO_FILE (f))
{
GError **error)
{
gboolean ret = FALSE;
- char *checksum_a = NULL;
- char *checksum_b = NULL;
+ ot_lfree char *checksum_a = NULL;
+ ot_lfree char *checksum_b = NULL;
DiffItem *ret_item = NULL;
if (!get_file_checksum (a, a_info, &checksum_a, cancellable, error))
out:
if (ret_item)
diff_item_unref (ret_item);
- g_free (checksum_a);
- g_free (checksum_b);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFileEnumerator *dir_enum = NULL;
GError *temp_error = NULL;
- GFile *child = NULL;
- GFileInfo *child_info = NULL;
+ ot_lobj GFileEnumerator *dir_enum = NULL;
+ ot_lobj GFile *child = NULL;
+ ot_lobj GFileInfo *child_info = NULL;
dir_enum = g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
ret = TRUE;
out:
- g_clear_object (&child_info);
- g_clear_object (&child);
- g_clear_object (&dir_enum);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFileEnumerator *dir_enum = NULL;
GError *temp_error = NULL;
- GFile *child_a = NULL;
- GFile *child_b = NULL;
- GFileInfo *child_a_info = NULL;
- GFileInfo *child_b_info = NULL;
+ ot_lobj GFileEnumerator *dir_enum = NULL;
+ ot_lobj GFile *child_a = NULL;
+ ot_lobj GFile *child_b = NULL;
+ ot_lobj GFileInfo *child_a_info = NULL;
+ ot_lobj GFileInfo *child_b_info = NULL;
dir_enum = g_file_enumerate_children (a, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
ret = TRUE;
out:
- g_clear_object (&dir_enum);
- g_clear_object (&child_a_info);
- g_clear_object (&child_b_info);
- g_clear_object (&child_a);
- g_clear_object (&child_b);
return ret;
}
gboolean ret = FALSE;
GOptionContext *context;
GCancellable *cancellable = NULL;
- OstreeRepo *repo = NULL;
- char *src_prev = NULL;
+ int i;
const char *src;
const char *target;
- GFile *srcf = NULL;
- GFile *targetf = NULL;
- GFile *cwd = NULL;
- GPtrArray *modified = NULL;
- GPtrArray *removed = NULL;
- GPtrArray *added = NULL;
- int i;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lfree char *src_prev = NULL;
+ ot_lobj GFile *srcf = NULL;
+ ot_lobj GFile *targetf = NULL;
+ ot_lobj GFile *cwd = NULL;
+ ot_lptrarray GPtrArray *modified = NULL;
+ ot_lptrarray GPtrArray *removed = NULL;
+ ot_lptrarray GPtrArray *added = NULL;
context = g_option_context_new ("REV TARGETDIR - Compare directory TARGETDIR against revision REV");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- g_free (src_prev);
- g_clear_object (&repo);
- g_clear_object (&cwd);
- g_clear_object (&srcf);
- g_clear_object (&targetf);
- if (modified)
- g_ptr_array_free (modified, TRUE);
- if (removed)
- g_ptr_array_free (removed, TRUE);
- if (added)
- g_ptr_array_free (added, TRUE);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GPtrArray *pack_indexes = NULL;
- GVariant *index_variant = NULL;
- GFile *pack_index_path = NULL;
- GFile *pack_data_path = NULL;
- GFileInfo *pack_info = NULL;
- GInputStream *input = NULL;
- GChecksum *pack_content_checksum = NULL;
- GVariantIter *index_content_iter = NULL;
guint i;
guint32 objtype;
guint64 offset;
guint64 pack_size;
+ ot_lptrarray GPtrArray *pack_indexes = NULL;
+ ot_lvariant GVariant *index_variant = NULL;
+ ot_lobj GFile *pack_index_path = NULL;
+ ot_lobj GFile *pack_data_path = NULL;
+ ot_lobj GFileInfo *pack_info = NULL;
+ ot_lobj GInputStream *input = NULL;
+ GChecksum *pack_content_checksum = NULL;
+ GVariantIter *index_content_iter = NULL;
if (!ostree_repo_list_pack_indexes (data->repo, &pack_indexes, cancellable, error))
goto out;
out:
if (index_content_iter)
g_variant_iter_free (index_content_iter);
- if (pack_content_checksum)
- g_checksum_free (pack_content_checksum);
- if (pack_indexes)
- g_ptr_array_unref (pack_indexes);
- g_clear_object (&pack_info);
- g_clear_object (&pack_data_path);
- g_clear_object (&input);
+ ot_clear_checksum (&pack_content_checksum);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GHashTable *reachable_objects = NULL;
GHashTableIter hash_iter;
gpointer key, value;
- GInputStream *input = NULL;
- GFileInfo *file_info = NULL;
- GVariant *xattrs = NULL;
- GVariant *metadata = NULL;
- GVariant *metadata_wrapped = NULL;
+ ot_lhash GHashTable *reachable_objects = NULL;
+ ot_lobj GInputStream *input = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
+ ot_lvariant GVariant *xattrs = NULL;
+ ot_lvariant GVariant *metadata = NULL;
+ ot_lvariant GVariant *metadata_wrapped = NULL;
GChecksum *computed_checksum = NULL;
reachable_objects = ostree_traverse_new_reachable ();
ret = TRUE;
out:
ot_clear_checksum (&computed_checksum);
- g_clear_object (&input);
- g_clear_object (&file_info);
- ot_clear_gvariant (&xattrs);
- ot_clear_gvariant (&metadata);
- ot_clear_gvariant (&metadata_wrapped);
- ot_clear_hashtable (&reachable_objects);
return ret;
}
GOptionContext *context;
OtFsckData data;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
- GHashTable *objects = NULL;
- GHashTable *commits = NULL;
GCancellable *cancellable = NULL;
GHashTableIter hash_iter;
gpointer key, value;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lhash GHashTable *objects = NULL;
+ ot_lhash GHashTable *commits = NULL;
context = g_option_context_new ("- Check the repository for consistency");
g_option_context_add_main_entries (context, options, NULL);
out:
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
- ot_clear_hashtable (&objects);
- ot_clear_hashtable (&commits);
return ret;
}
{
GOptionContext *context = NULL;
gboolean ret = FALSE;
- GFile *child = NULL;
- GFile *grandchild = NULL;
GCancellable *cancellable = NULL;
+ ot_lobj GFile *child = NULL;
+ ot_lobj GFile *grandchild = NULL;
+ ot_lobj OstreeRepo *repo = NULL;
GString *config_data = NULL;
- OstreeRepo *repo = NULL;
context = g_option_context_new ("- Initialize a new empty repository");
g_option_context_add_main_entries (context, options, NULL);
g_option_context_free (context);
if (config_data)
g_string_free (config_data, TRUE);
- g_clear_object (&child);
- g_clear_object (&grandchild);
- g_clear_object (&repo);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *child_src = NULL;
- GFile *child_dest = NULL;
- GFileEnumerator *dir_enum = NULL;
- GFileInfo *file_info = NULL;
GError *temp_error = NULL;
+ ot_lobj GFile *child_src = NULL;
+ ot_lobj GFile *child_dest = NULL;
+ ot_lobj GFileEnumerator *dir_enum = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
dir_enum = g_file_enumerate_children (src, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
ret = TRUE;
out:
- g_clear_object (&dir_enum);
- g_clear_object (&child_src);
- g_clear_object (&child_dest);
- g_clear_object (&file_info);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *objfile = NULL;
- GFileInfo *file_info = NULL;
- GFile *content_path = NULL;
- GFileInfo *archive_info = NULL;
- GVariant *archive_metadata = NULL;
- GVariant *xattrs = NULL;
- GInputStream *input = NULL;
+ ot_lobj GFile *objfile = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
+ ot_lobj GFile *content_path = NULL;
+ ot_lobj GFileInfo *archive_info = NULL;
+ ot_lvariant GVariant *archive_metadata = NULL;
+ ot_lvariant GVariant *xattrs = NULL;
+ ot_lobj GInputStream *input = NULL;
objfile = ostree_repo_get_object_path (data->src_repo, checksum, objtype);
file_info = g_file_query_info (objfile, OSTREE_GIO_FAST_QUERYINFO,
ret = TRUE;
out:
- ot_clear_gvariant (&archive_metadata);
- ot_clear_gvariant (&xattrs);
- g_clear_object (&archive_info);
- g_clear_object (&input);
- g_clear_object (&content_path);
- g_clear_object (&file_info);
- g_clear_object (&objfile);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *src_path = NULL;
- GFile *dest_path = NULL;
- GFile *dest_parent = NULL;
- char *refpath = NULL;
+ ot_lobj GFile *src_path = NULL;
+ ot_lobj GFile *dest_path = NULL;
+ ot_lobj GFile *dest_parent = NULL;
+ ot_lfree char *refpath = NULL;
refpath = g_build_filename ("refs/heads", name, NULL);
src_path = g_file_resolve_relative_path (src_repo_dir, refpath);
ret = TRUE;
out:
- g_clear_object (&src_path);
- g_clear_object (&dest_path);
- g_clear_object (&dest_parent);
- g_free (refpath);
return ret;
}
{
gboolean ret = FALSE;
GCancellable *cancellable = NULL;
- GHashTable *objects = NULL;
GOptionContext *context;
const char *destination;
- GFile *dest_f = NULL;
- OtLocalCloneData data;
- GFile *src_repo_dir = NULL;
- GFile *dest_repo_dir = NULL;
- GFileInfo *src_info = NULL;
- GFileInfo *dest_info = NULL;
- GFile *src_dir = NULL;
- GFile *dest_dir = NULL;
int i;
GHashTableIter hash_iter;
gpointer key, value;
+ ot_lhash GHashTable *objects = NULL;
+ ot_lobj GFile *dest_f = NULL;
+ ot_lobj GFile *src_repo_dir = NULL;
+ ot_lobj GFile *dest_repo_dir = NULL;
+ ot_lobj GFileInfo *src_info = NULL;
+ ot_lobj GFileInfo *dest_info = NULL;
+ ot_lobj GFile *src_dir = NULL;
+ ot_lobj GFile *dest_dir = NULL;
+ OtLocalCloneData data;
context = g_option_context_new ("DEST ... - Create new repository DEST");
g_option_context_add_main_entries (context, options, NULL);
out:
if (context)
g_option_context_free (context);
- g_clear_object (&dest_f);
- g_clear_object (&src_repo_dir);
- g_clear_object (&dest_repo_dir);
- g_clear_object (&src_info);
- g_clear_object (&dest_info);
- g_clear_object (&src_dir);
- g_clear_object (&dest_dir);
- g_clear_object (&data.src_repo);
- g_clear_object (&data.dest_repo);
- if (objects)
- g_hash_table_unref (objects);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
- GOutputStream *pager = NULL;
const char *rev;
- GVariant *commit = NULL;
- char *resolved_rev = NULL;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lobj GOutputStream *pager = NULL;
+ ot_lvariant GVariant *commit = NULL;
+ ot_lfree char *resolved_rev = NULL;
context = g_option_context_new ("- Show revision log");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- g_free (resolved_rev);
if (context)
g_option_context_free (context);
- ot_clear_gvariant (&commit);
- g_clear_object (&repo);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFileEnumerator *dir_enum = NULL;
- GFile *child = NULL;
- GFileInfo *child_info = NULL;
+ ot_lobj GFileEnumerator *dir_enum = NULL;
+ ot_lobj GFile *child = NULL;
+ ot_lobj GFileInfo *child_info = NULL;
GError *temp_error = NULL;
dir_enum = g_file_enumerate_children (f, OSTREE_GIO_FAST_QUERYINFO,
ret = TRUE;
out:
- g_clear_object (&child_info);
- g_clear_object (&child);
- g_clear_object (&dir_enum);
return ret;
}
gpointer b = *((gpointer*)bp);
GVariant *a_v = a;
GVariant *b_v = b;
- GVariant *a_csum_bytes;
- GVariant *b_csum_bytes;
guint32 a_objtype;
guint32 b_objtype;
guint64 a_offset;
guint64 b_offset;
int c;
+ ot_lvariant GVariant *a_csum_bytes = NULL;
+ ot_lvariant GVariant *b_csum_bytes = NULL;
g_variant_get (a_v, "(u@ayt)", &a_objtype, &a_csum_bytes, &a_offset);
g_variant_get (b_v, "(u@ayt)", &b_objtype, &b_csum_bytes, &b_offset);
GError **error)
{
gboolean ret = FALSE;
- GFile *object_path = NULL;
- GFile *content_object_path = NULL;
- GVariant *archive_meta = NULL;
- GFileInfo *file_info = NULL;
- GVariant *xattrs = NULL;
+ ot_lobj GFile *object_path = NULL;
+ ot_lobj GFile *content_object_path = NULL;
+ ot_lvariant GVariant *archive_meta = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
+ ot_lvariant GVariant *xattrs = NULL;
object_path = ostree_repo_get_object_path (data->repo, checksum, objtype);
ret = TRUE;
out:
- g_clear_object (&object_path);
- g_clear_object (&content_object_path);
- ot_clear_gvariant (&archive_meta);
- g_clear_object (&file_info);
- ot_clear_gvariant (&xattrs);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *pack_dir = NULL;
- GFile *index_temppath = NULL;
- GOutputStream *index_out = NULL;
- GFile *pack_temppath = NULL;
- GOutputStream *pack_out = NULL;
- GFile *object_path = NULL;
- GFileInfo *object_file_info = NULL;
- GFileInputStream *object_input = NULL;
- GConverter *compressor = NULL;
- GConverterInputStream *compressed_object_input = NULL;
guint i;
guint64 offset;
gsize bytes_written;
- GPtrArray *index_content_list = NULL;
- GVariant *pack_header = NULL;
- GVariant *packed_object = NULL;
- GVariant *index_content = NULL;
+ ot_lobj GFile *pack_dir = NULL;
+ ot_lobj GFile *index_temppath = NULL;
+ ot_lobj GOutputStream *index_out = NULL;
+ ot_lobj GFile *pack_temppath = NULL;
+ ot_lobj GOutputStream *pack_out = NULL;
+ ot_lobj GFile *object_path = NULL;
+ ot_lobj GFileInfo *object_file_info = NULL;
+ ot_lobj GFileInputStream *object_input = NULL;
+ ot_lobj GConverter *compressor = NULL;
+ ot_lobj GConverterInputStream *compressed_object_input = NULL;
+ ot_lptrarray GPtrArray *index_content_list = NULL;
+ ot_lvariant GVariant *pack_header = NULL;
+ ot_lvariant GVariant *packed_object = NULL;
+ ot_lvariant GVariant *index_content = NULL;
+ ot_lfree char *pack_name = NULL;
+ ot_lobj GFile *pack_file_path = NULL;
+ ot_lobj GFile *pack_index_path = NULL;
+ GMemoryOutputStream *object_data_stream = NULL;
GVariantBuilder index_content_builder;
GChecksum *pack_checksum = NULL;
- char *pack_name = NULL;
- GFile *pack_file_path = NULL;
- GFile *pack_index_path = NULL;
- GMemoryOutputStream *object_data_stream = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
out:
if (index_temppath)
(void) unlink (ot_gfile_get_path_cached (index_temppath));
- g_clear_object (&index_temppath);
- g_clear_object (&index_out);
if (pack_temppath)
(void) unlink (ot_gfile_get_path_cached (pack_temppath));
- g_clear_object (&pack_temppath);
- g_clear_object (&pack_out);
- g_clear_object (&object_path);
- g_clear_object (&object_input);
- g_clear_object (&compressor);
- g_clear_object (&compressed_object_input);
- g_clear_object (&object_file_info);
if (pack_checksum)
g_checksum_free (pack_checksum);
- g_clear_object (&pack_dir);
- ot_clear_gvariant (&index_content);
- g_free (pack_name);
- g_clear_object (&pack_file_path);
- g_clear_object (&pack_index_path);
- if (index_content_list)
- g_ptr_array_unref (index_content_list);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GPtrArray *ret_clusters = NULL;
- GPtrArray *object_list = NULL;
guint i;
guint64 current_size;
guint current_offset;
GHashTableIter hash_iter;
gpointer key, value;
- GFile *object_path = NULL;
- GFileInfo *object_info = NULL;
+ ot_lptrarray GPtrArray *ret_clusters = NULL;
+ ot_lptrarray GPtrArray *object_list = NULL;
+ ot_lobj GFile *object_path = NULL;
+ ot_lobj GFileInfo *object_info = NULL;
object_list = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
ret = TRUE;
ot_transfer_out_value (out_clusters, &ret_clusters);
out:
- if (object_list)
- g_ptr_array_unref (object_list);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GHashTable *ret_loose = NULL;
guint n_loose = 0;
guint n_loose_and_packed = 0;
guint n_packed = 0;
guint n_files = 0;
GHashTableIter hash_iter;
gpointer key, value;
+ ot_lhash GHashTable *ret_loose = NULL;
ret_loose = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,
(GDestroyNotify) g_variant_unref,
ret = TRUE;
ot_transfer_out_value (out_loose, &ret_loose);
/* out: */
- if (ret_loose)
- g_hash_table_unref (ret_loose);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GHashTable *objects = NULL;
guint i;
- GPtrArray *clusters = NULL;
- GHashTable *loose_objects = NULL;
+ ot_lhash GHashTable *objects = NULL;
+ ot_lptrarray GPtrArray *clusters = NULL;
+ ot_lhash GHashTable *loose_objects = NULL;
if (!ostree_repo_list_objects (data->repo, OSTREE_REPO_LIST_OBJECTS_ALL, &objects,
cancellable, error))
ret = TRUE;
out:
- if (clusters)
- g_ptr_array_unref (clusters);
- if (loose_objects)
- g_hash_table_unref (loose_objects);
- if (objects)
- g_hash_table_unref (objects);
return ret;
}
{
gboolean ret = FALSE;
GOptionContext *context;
- OtRepackData data;
- OstreeRepo *repo = NULL;
GCancellable *cancellable = NULL;
+ OtRepackData data;
+ ot_lobj OstreeRepo *repo = NULL;
memset (&data, 0, sizeof (data));
out:
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GVariant *key = NULL;
- GFile *objf = NULL;
+ ot_lvariant GVariant *key = NULL;
+ ot_lobj GFile *objf = NULL;
key = ostree_object_name_serialize (checksum, objtype);
ret = TRUE;
out:
- g_clear_object (&objf);
- ot_clear_gvariant (&key);
return ret;
}
{
gboolean ret = FALSE;
GOptionContext *context;
- OtPruneData data;
- GHashTable *objects = NULL;
- OstreeRepo *repo = NULL;
- GHashTable *all_refs = NULL;
GHashTableIter hash_iter;
gpointer key, value;
GCancellable *cancellable = NULL;
+ ot_lhash GHashTable *objects = NULL;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lhash GHashTable *all_refs = NULL;
+ OtPruneData data;
memset (&data, 0, sizeof (data));
ret = TRUE;
out:
- if (all_refs)
- g_hash_table_unref (all_refs);
if (data.reachable)
g_hash_table_unref (data.reachable);
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
- if (objects)
- g_hash_table_unref (objects);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
const char *op;
- GKeyFile *config = NULL;
- GPtrArray *branches = NULL;
guint i;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lptrarray GPtrArray *branches = NULL;
+ GKeyFile *config = NULL;
context = g_option_context_new ("OPERATION [args] - Control remote repository configuration");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- ot_clear_ptrarray (&branches);
if (context)
g_option_context_free (context);
if (config)
g_key_file_free (config);
- g_clear_object (&repo);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
const char *rev = "master";
- char *resolved_rev = NULL;
- GVariant *variant = NULL;
- char *formatted_variant = NULL;
int i;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lfree char *resolved_rev = NULL;
+ ot_lvariant GVariant *variant = NULL;
+ ot_lfree char *formatted_variant = NULL;
context = g_option_context_new ("REV - Output the target of a rev");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- g_free (resolved_rev);
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
- ot_clear_gvariant (&variant);
- g_free (formatted_variant);
return ret;
}
static void
print_variant (GVariant *variant)
{
- char *formatted_variant = NULL;
- GVariant *byteswapped = NULL;
+ ot_lfree char *formatted_variant = NULL;
+ ot_lvariant GVariant *byteswapped = NULL;
if (G_BYTE_ORDER != G_BIG_ENDIAN)
{
formatted_variant = g_variant_print (variant, TRUE);
}
g_print ("%s\n", formatted_variant);
-
- g_free (formatted_variant);
- ot_clear_gvariant (&byteswapped);
}
static gboolean
GError **error)
{
gboolean ret = FALSE;
- GFile *f = NULL;
- GVariant *variant = NULL;
+ ot_lobj GFile *f = NULL;
+ ot_lvariant GVariant *variant = NULL;
f = ot_gfile_new_for_path (filename);
ret = TRUE;
out:
- ot_clear_gvariant (&variant);
- g_clear_object (&f);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GVariant *variant = NULL;
- GFile *object_path = NULL;
- GInputStream *in = NULL;
char buf[8192];
gsize bytes_read;
OstreeObjectType objtype;
+ ot_lvariant GVariant *variant = NULL;
+ ot_lobj GFile *object_path = NULL;
+ ot_lobj GInputStream *in = NULL;
for (objtype = OSTREE_OBJECT_TYPE_RAW_FILE; objtype <= OSTREE_OBJECT_TYPE_COMMIT; objtype++)
{
ret = TRUE;
out:
- ot_clear_gvariant (&variant);
- g_clear_object (&in);
- g_clear_object (&object_path);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GVariant *variant = NULL;
- GVariant *metadata = NULL;
- GVariant *compose_contents = NULL;
- GVariantIter *viter = NULL;
- GHashTable *metadata_hash = NULL;
const char *branch;
const char *branchrev;
+ ot_lvariant GVariant *variant = NULL;
+ ot_lvariant GVariant *metadata = NULL;
+ ot_lvariant GVariant *compose_contents = NULL;
+ ot_lhash GHashTable *metadata_hash = NULL;
+ GVariantIter *viter = NULL;
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT,
resolved_rev, &variant, error))
ret = TRUE;
out:
- ot_clear_gvariant (&variant);
if (viter)
g_variant_iter_free (viter);
- ot_clear_gvariant (&metadata);
- if (metadata_hash)
- g_hash_table_destroy (metadata_hash);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GVariant *commit = NULL;
- GVariant *metadata = NULL;
const char *value;
+ ot_lvariant GVariant *commit = NULL;
+ ot_lvariant GVariant *metadata = NULL;
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT,
resolved_rev, &commit, error))
ret = TRUE;
out:
- ot_clear_gvariant (&metadata);
- ot_clear_gvariant (&commit);
return ret;
}
{
GOptionContext *context;
gboolean ret = FALSE;
- OstreeRepo *repo = NULL;
const char *rev;
- char *resolved_rev = NULL;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lfree char *resolved_rev = NULL;
context = g_option_context_new ("OBJECT - Output a metadata object");
g_option_context_add_main_entries (context, options, NULL);
ret = TRUE;
out:
- g_free (resolved_rev);
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GHashTable *ret_packed = NULL;
- GHashTableIter hash_iter;
gpointer key, value;
- GVariant *pack_array = NULL;
+ GHashTableIter hash_iter;
+ ot_lhash GHashTable *ret_packed = NULL;
+ ot_lvariant GVariant *pack_array = NULL;
ret_packed = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,
(GDestroyNotify) g_variant_unref,
ret = TRUE;
ot_transfer_out_value (out_packed, &ret_packed);
/* out: */
- ot_clear_gvariant (&pack_array);
- if (ret_packed)
- g_hash_table_unref (ret_packed);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GInputStream *input = NULL;
- GFileInfo *file_info = NULL;
- GVariant *xattrs = NULL;
- GVariant *meta = NULL;
- GVariant *serialized_meta = NULL;
+ ot_lobj GInputStream *input = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
+ ot_lvariant GVariant *xattrs = NULL;
+ ot_lvariant GVariant *meta = NULL;
+ ot_lvariant GVariant *serialized_meta = NULL;
g_assert (objtype != OSTREE_OBJECT_TYPE_RAW_FILE);
ret = TRUE;
out:
- g_clear_object (&input);
- g_clear_object (&file_info);
- ot_clear_gvariant (&xattrs);
- ot_clear_gvariant (&meta);
- ot_clear_gvariant (&serialized_meta);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GFile *data_path = NULL;
- GFile *index_path = NULL;
+ ot_lobj GFile *data_path = NULL;
+ ot_lobj GFile *index_path = NULL;
index_path = ostree_repo_get_pack_index_path (repo, pack_checksum);
data_path = ostree_repo_get_pack_data_path (repo, pack_checksum);
ret = TRUE;
out:
- g_clear_object (&index_path);
- g_clear_object (&data_path);
return ret;
}
{
gboolean ret = FALSE;
GOptionContext *context;
+ GCancellable *cancellable = NULL;
gboolean in_transaction = FALSE;
OtUnpackData data;
- OstreeRepo *repo = NULL;
- GHashTable *objects = NULL;
- GCancellable *cancellable = NULL;
- GPtrArray *clusters = NULL;
- GHashTable *packed_objects = NULL;
- GHashTableIter hash_iter;
- GHashTable *packfiles_to_delete = NULL;
gpointer key, value;
- GFile *objpath = NULL;
guint64 unpacked_object_count = 0;
+ GHashTableIter hash_iter;
+ ot_lobj OstreeRepo *repo = NULL;
+ ot_lhash GHashTable *objects = NULL;
+ ot_lptrarray GPtrArray *clusters = NULL;
+ ot_lhash GHashTable *packed_objects = NULL;
+ ot_lhash GHashTable *packfiles_to_delete = NULL;
+ ot_lobj GFile *objpath = NULL;
memset (&data, 0, sizeof (data));
out:
if (in_transaction)
(void) ostree_repo_abort_transaction (repo, cancellable, NULL);
- g_clear_object (&objpath);
if (context)
g_option_context_free (context);
- g_clear_object (&repo);
- if (clusters)
- g_ptr_array_unref (clusters);
- if (packfiles_to_delete)
- g_hash_table_unref (packfiles_to_delete);
- if (packed_objects)
- g_hash_table_unref (packed_objects);
- if (objects)
- g_hash_table_unref (objects);
return ret;
}